package com.wuxuan.javabase_homework.homework3;

/**
 * 书本类
 */
public class Book {
    private static int count;
    private int id;
    private String name;
    private String author;
    private String publisher;
    private double price;
    private double discount;
    private double actualPrice;
    private int sale;
    private int inventory;

    public Book() {
        this.id = ++count;
    }

    public Book(String name, String author, String publisher, double price, double discount, int inventory) {
        this.id = ++count;
        this.name = name;
        this.author = author;
        this.publisher = publisher;
        this.price = price;
        this.discount = discount;
        this.actualPrice = price * discount;
        this.sale = sale;
        this.inventory = inventory;

    }

    public static int getCount() {
        return count;
    }

    public static void setCount(int count) {
        Book.count = count;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
        this.actualPrice = price * discount;
    }

    public double getDiscount() {
        return discount;
    }

    public void setDiscount(double discount) {
        this.discount = discount;
        this.actualPrice = price * discount;
    }

    public double getActualPrice() {
        return actualPrice;
    }

    public void setActualPrice(double actualPrice) {
        this.actualPrice = actualPrice;
    }

    public int getSale() {
        return sale;
    }

    public void setSale(int sale) {
        this.sale = sale;
    }

    public int getInventory() {
        return inventory;
    }

    public void setInventory(int inventory) {
        this.inventory = inventory;
    }

    @Override
    public String toString() {
        return  "\n" +
                "Book{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", author='" + author + '\'' +
                ", publisher='" + publisher + '\'' +
                ", price=" + price +
                ", discount=" + discount +
                ", actualPrice=" + actualPrice +
                ", sale=" + sale +
                ", inventory=" + inventory +
                '}' + "\n";
    }
}
